entry completion: Make final
authorMatthias Clasen <mclasen@redhat.com>
Tue, 28 May 2019 00:03:24 +0000 (00:03 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 28 May 2019 00:23:50 +0000 (20:23 -0400)
gtk/gtkentrycompletion.h
gtk/gtkentryprivate.h
testsuite/gtk/cellarea.c

index d06449b26c59d2011cc7b228ed536246b21a0497..dfe561c474855b8eba6ec17aa4349da6f658557d 100644 (file)
@@ -33,14 +33,9 @@ G_BEGIN_DECLS
 
 #define GTK_TYPE_ENTRY_COMPLETION            (gtk_entry_completion_get_type ())
 #define GTK_ENTRY_COMPLETION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletion))
-#define GTK_ENTRY_COMPLETION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
 #define GTK_IS_ENTRY_COMPLETION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_COMPLETION))
-#define GTK_IS_ENTRY_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_COMPLETION))
-#define GTK_ENTRY_COMPLETION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
 
 typedef struct _GtkEntryCompletion            GtkEntryCompletion;
-typedef struct _GtkEntryCompletionClass       GtkEntryCompletionClass;
-typedef struct _GtkEntryCompletionPrivate     GtkEntryCompletionPrivate;
 
 /**
  * GtkEntryCompletionMatchFunc:
@@ -65,37 +60,6 @@ typedef gboolean (* GtkEntryCompletionMatchFunc) (GtkEntryCompletion *completion
                                                   gpointer            user_data);
 
 
-struct _GtkEntryCompletion
-{
-  GObject parent_instance;
-
-  /*< private >*/
-  GtkEntryCompletionPrivate *priv;
-};
-
-struct _GtkEntryCompletionClass
-{
-  GObjectClass parent_class;
-
-  gboolean (* match_selected)   (GtkEntryCompletion *completion,
-                                 GtkTreeModel       *model,
-                                 GtkTreeIter        *iter);
-  void     (* action_activated) (GtkEntryCompletion *completion,
-                                 gint                index_);
-  gboolean (* insert_prefix)    (GtkEntryCompletion *completion,
-                                 const gchar        *prefix);
-  gboolean (* cursor_on_match)  (GtkEntryCompletion *completion,
-                                 GtkTreeModel       *model,
-                                 GtkTreeIter        *iter);
-  void     (* no_matches)       (GtkEntryCompletion *completion);
-
-  /* Padding for future expansion */
-  void (*_gtk_reserved0) (void);
-  void (*_gtk_reserved1) (void);
-  void (*_gtk_reserved2) (void);
-};
-
-/* core */
 GDK_AVAILABLE_IN_ALL
 GType               gtk_entry_completion_get_type               (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
index 5d6c9d88773882367a3ca6d2fd7d91616f6f45d6..14696eb5ca9f675ac2918235bc8c700fcc8c6db6 100644 (file)
 
 G_BEGIN_DECLS
 
+typedef struct _GtkEntryCompletionClass       GtkEntryCompletionClass;
+typedef struct _GtkEntryCompletionPrivate     GtkEntryCompletionPrivate;
+
+struct _GtkEntryCompletion
+{
+  GObject parent_instance;
+
+  /*< private >*/
+  GtkEntryCompletionPrivate *priv;
+};
+
+struct _GtkEntryCompletionClass
+{
+  GObjectClass parent_class;
+
+  gboolean (* match_selected)   (GtkEntryCompletion *completion,
+                                 GtkTreeModel       *model,
+                                 GtkTreeIter        *iter);
+  void     (* action_activated) (GtkEntryCompletion *completion,
+                                 gint                index_);
+  gboolean (* insert_prefix)    (GtkEntryCompletion *completion,
+                                 const gchar        *prefix);
+  gboolean (* cursor_on_match)  (GtkEntryCompletion *completion,
+                                 GtkTreeModel       *model,
+                                 GtkTreeIter        *iter);
+  void     (* no_matches)       (GtkEntryCompletion *completion);
+};
+
 struct _GtkEntryCompletionPrivate
 {
   GtkWidget *entry;
index 6586843eb0e331bbe17c8c3dcde74da6ebee5ced..a80f40caeaa9a73f930decf5eb4302129f03c4f7 100644 (file)
@@ -521,116 +521,6 @@ test_completion_object_new (void)
   g_object_unref (c);
 }
 
-typedef GtkEntryCompletion MyEntryCompletion;
-typedef GtkEntryCompletionClass MyEntryCompletionClass;
-
-GType my_entry_completion_get_type (void);
-
-G_DEFINE_TYPE (MyEntryCompletion, my_entry_completion, GTK_TYPE_ENTRY_COMPLETION)
-
-static void
-my_entry_completion_class_init (MyEntryCompletionClass *klass)
-{
-}
-
-static void
-my_entry_completion_init (MyEntryCompletion *c)
-{
-  GtkCellArea *area;
-
-  if (subclass_init == 0)
-    {
-      /* do nothing to area */
-    }
-  else if (subclass_init == 1)
-    {
-      area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c));
-      g_assert (GTK_IS_CELL_AREA_BOX (area));
-      g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
-      gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_VERTICAL);
-    }
-}
-
-/* test that a completion subclass has an area */
-static void
-test_completion_subclass0 (void)
-{
-  GtkEntryCompletion *c;
-  GtkCellArea *area;
-
-  subclass_init = 0;
-
-  c = g_object_new (my_entry_completion_get_type (), NULL);
-  area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c));
-  g_assert (GTK_IS_CELL_AREA_BOX (area));
-  g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
-
-  g_object_ref_sink (c);
-  g_object_unref (c);
-}
-
-/* test that a completion subclass keeps the provided area */
-static void
-test_completion_subclass1 (void)
-{
-  GtkEntryCompletion *c;
-  GtkCellArea *area;
-
-  subclass_init = 0;
-
-  area = gtk_cell_area_box_new ();
-  c = g_object_new (my_entry_completion_get_type (), "cell-area", area, NULL);
-  g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)));
-  g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
-
-  g_object_ref_sink (c);
-  g_object_unref (c);
-}
-
-/* test we can access the area in subclass init */
-static void
-test_completion_subclass2 (void)
-{
-  GtkEntryCompletion *c;
-  GtkCellArea *area;
-
-  subclass_init = 1;
-
-  c = g_object_new (my_entry_completion_get_type (), NULL);
-  area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c));
-  g_assert (GTK_IS_CELL_AREA_BOX (area));
-  g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);
-
-  g_object_ref_sink (c);
-  g_object_unref (c);
-}
-
-static void
-test_completion_subclass3_subprocess (void)
-{
-  GtkEntryCompletion *c;
-  GtkCellArea *area;
-
-  subclass_init = 1;
-
-  area = gtk_cell_area_box_new ();
-  c = g_object_new (my_entry_completion_get_type (), "cell-area", area, NULL);
-  g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)));
-  g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);
-
-  g_object_ref_sink (c);
-  g_object_unref (c);
-}
-
-/* test we get a warning if an area is provided, but ignored */
-static void
-test_completion_subclass3 (void)
-{
-  g_test_trap_subprocess ("/tests/completion-subclass3/subprocess", 0, 0);
-  g_test_trap_assert_failed ();
-  g_test_trap_assert_stderr ("*ignoring construct property*");
-}
-
 int
 main (int argc, char *argv[])
 {
@@ -666,11 +556,6 @@ main (int argc, char *argv[])
   g_test_add_func ("/tests/completion-new", test_completion_new);
   g_test_add_func ("/tests/completion-new-with-area", test_completion_new_with_area);
   g_test_add_func ("/tests/completion-object-new", test_completion_object_new);
-  g_test_add_func ("/tests/completion-subclass0", test_completion_subclass0);
-  g_test_add_func ("/tests/completion-subclass1", test_completion_subclass1);
-  g_test_add_func ("/tests/completion-subclass2", test_completion_subclass2);
-  g_test_add_func ("/tests/completion-subclass3", test_completion_subclass3);
-  g_test_add_func ("/tests/completion-subclass3/subprocess", test_completion_subclass3_subprocess);
 
   return g_test_run();
 }